package cn.iocoder.yudao.module.data.dal.mysql.ds;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.data.controller.admin.ds.vo.DsPageReqVO;
import cn.iocoder.yudao.module.data.controller.admin.ds.vo.DsRespVO;
import cn.iocoder.yudao.module.data.controller.admin.dscategory.vo.DsCategoryPageReqVO;
import cn.iocoder.yudao.module.data.controller.admin.dscategory.vo.DsCategoryRespVO;
import cn.iocoder.yudao.module.data.dal.dataobject.ds.DsTableDO;
import cn.iocoder.yudao.module.data.dal.dataobject.dscategory.DsCategoryDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collection;
import java.util.List;

/**
 * 分类 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DsMapper extends BaseMapperX<DsTableDO> {

    default PageResult<DsTableDO> selectPage(DsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DsTableDO>()
                .likeIfPresent(DsTableDO::getName, reqVO.getName())
                .eqIfPresent(DsTableDO::getDescription, reqVO.getDescription())
                .eqIfPresent(DsTableDO::getDsId, reqVO.getDsId())
                .eqIfPresent(DsTableDO::getDatasetGroupId, reqVO.getDatasetGroupId())
                .eqIfPresent(DsTableDO::getType, reqVO.getType())
                .betweenIfPresent(DsTableDO::getCreateTime, reqVO.getCreateTime()));
    }

    default List<DsTableDO> selectList(DsRespVO reqVO) {
//        return selectList(new LambdaQueryWrapperX<DsCategoryDO>()
//                .likeIfPresent(DsCategoryDO::getName, reqVO.getName())
//                .eqIfPresent(DsCategoryDO::getStatus, reqVO.getStatus()));
        return selectList(new LambdaQueryWrapperX<DsTableDO>()
                .likeIfPresent(DsTableDO::getName, reqVO.getName())
                .eqIfPresent(DsTableDO::getDescription, reqVO.getDescription())
                .eqIfPresent(DsTableDO::getDsId, reqVO.getDsId())
                .eqIfPresent(DsTableDO::getDatasetGroupId, reqVO.getDatasetGroupId())
                .eqIfPresent(DsTableDO::getType, reqVO.getType()));
    }


}